%% -*- erlang -*-

case os:getenv("TRAVIS") of
    "true" ->
        CONFIG0 = [
            {cover_enabled          , true},
            {cover_export_enabled   , true},
            {coveralls_coverdata    , "_build/test/cover/eunit.coverdata"},
            {coveralls_service_name , "travis-ci"}
            | CONFIG
        ],

        JobId   = os:getenv("TRAVIS_JOB_ID"),
        CONFIG1 = lists:keystore(coveralls_service_job_id, 1, CONFIG0, {coveralls_service_job_id, JobId}),
        Plungins = case lists:keyfind(plugins, 1, CONFIG) of
            {plugins, P} -> P;
            false -> []
        end,
        lists:keystore(plugins, 1, CONFIG1, {plugins, [
            {coveralls, {git, "https://github.com/markusn/coveralls-erl", {branch, "master"}}}
            | Plungins
        ]});
    _ ->
        CONFIG
end.
